<template>
  <el-card class="rights-container">
    <bread :params1="'权限管理'" :params2="'权限列表'"></bread>

    <el-table :data="rightsList" border style="width: 100%">
      <el-table-column type="index" label="#" width="180"> </el-table-column>
      <el-table-column prop="authName" label="权限名称" width="180">
      </el-table-column>
      <el-table-column prop="path" label="路径" width="180"> </el-table-column>
      <el-table-column prop="level" label="权限等级">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.level == 0">标签一</el-tag>
          <el-tag v-else-if="scope.row.level == 1" type="success"
            >标签二</el-tag
          >
          <el-tag v-else-if="scope.row.level == 2" type="warning"
            >标签三</el-tag
          >
        </template>
      </el-table-column>
    </el-table>
  </el-card>
</template>

<script>
import { rights_api } from "@/api";
export default {
  data() {
    return {
      rightsList: []
    };
  },
  methods: {
    async rightsapi() {
      const { data: res } = await rights_api("list");
      // console.log(res.data, 44444);
      this.rightsList = res.data;
    }
  },
  created() {
    this.rightsapi();
  }
};
</script>
<style scoped lang="less">
.rights-container {
  .el-table {
    margin: 15px 0;
  }
}
</style>
